<template>
  <div>
    <el-tabs @tab-click="tabClick" type="border-card">
      <el-tab-pane label="基础信息">
        <BasicInfo />
      </el-tab-pane>
      <el-tab-pane label="预约基础配置">
        <Form ref="form" :model="data" :label-width="160">
          <div class="fixed">
            <FormItem label="是否开启身份校验：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.idCardSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip max-width="400" content="身份校验是指游客预约时是否需提供身份信息" placement="bottom">
                  <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="全国健康码的校验：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.healthCodeSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip max-width="400" content="健康码校验是指游客预约时是否检查健康码" placement="bottom">
                  <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="是否开启多次入园：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.multipleAdmissionsSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip max-width="400" content="多次入园是指游客一次预约是否可以使用多次" placement="bottom">
                  <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="同一场次重复预约：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.duplicateSessionSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip max-width="400" content="开启后，当天同一场次将会允许重复预约" placement="bottom">
                  <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
                </Tooltip>
              </div>
            </FormItem>
            <FormItem label="是否开启个人预约：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.personalAppointmentSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip max-width="400" content="开启后，个人预约通道将被打开" placement="bottom">
                  <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
                </Tooltip>
              </div>
            </FormItem>
            <!-- <FormItem label="是否开启团队预约：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.teamAppointmentSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip
                  max-width="400"
                  content="开启后，团队预约通道将被打开"
                  placement="bottom"
                >
                  <Icon
                    style="margin-left: 10px; margin-top: 7px"
                    size="20"
                    type="ios-help-circle-outline"
                  />
                </Tooltip>
              </div>
            </FormItem> -->

            <FormItem label="是否开启临时闭馆：" class="formitem">
              <div style="display: flex; align-items: center">
                <i-switch v-model="data.temporaryClosureSwitch" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
                <Tooltip max-width="400" content="开启后，将临时闭馆" placement="bottom">
                  <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
                </Tooltip>
              </div>
            </FormItem>
          </div>
          <div class="fixed">
            <FormItem label="单次预约最多人数：" style="width: 33%">
              <InputNumber :max="1000" :min="1" v-model="data.singleLimit"></InputNumber>
              <Tooltip max-width="400" content="单次可协助预约的最大人数设置" placement="bottom">
                <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </FormItem>
            <FormItem label="单次预约最多人数(未成年)" style="width: 33%">
              <InputNumber :max="1000" :min="1" v-model="data.singleChildLimit"></InputNumber>
              <Tooltip max-width="400" content="单次预约最多人数(未成年)" placement="bottom">
                <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </FormItem>
            <FormItem label="提前核销（分钟）：" style="width: 33%">
              <InputNumber :min="0" :max="60" v-model="data.advanceMinute"></InputNumber>
              <Tooltip max-width="400" content="填写提前核销的分钟数，当游客到馆时间提前于预约场次时间，并在提前核销范围内，可核销入馆，设置范围为0~60分钟，不可设置跨日。"
                placement="bottom">
                <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </FormItem>
            <FormItem label="延迟核销（分钟）：" style="width: 33%">
              <InputNumber :min="0" :max="60" v-model="data.delayedMinute"></InputNumber>
              <Tooltip max-width="400" content="填写延迟核销的分钟数，当游客到馆时间晚于预约场次时间，并在延迟核销范围内，可核销入馆，设置范围为0~60分钟，不可设置跨日。"
                placement="bottom">
                <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </FormItem>
            <FormItem label="个人预约提前预约天数" style="width: 33%">
              <InputNumber :min="0" v-model="data.advanceDay"></InputNumber>
              <Tooltip max-width="400" content="个人预约提前预约天数" placement="bottom">
                <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </FormItem>
            <FormItem label="个人预约开放天数（一周内）：" style="width: 33%">
              <InputNumber :min="0" :max="7" v-model="data.openDay"></InputNumber>
              <Tooltip max-width="400" content="个人预约开放天数（一周内）" placement="bottom">
                <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </FormItem>

          </div>
          <FormItem label="团队预约配置：" style="width: 33%">
            <Button type="success" size="large" style="width: 100%; margintop: 20px" @click="modalzq = true"
              :loading="spinShow2">配置
            </Button>

            <Modal v-model="modalzq" title="团队预约配置" @on-ok="ok" width="1080px">
              <div style="display: flex; flex-direction: row;align-items: center;">
                <div style="width: 8vw;text-align: center;line-height: 42px;">闭馆时间:</div>
                <DatePicker transfer :clearable="false" :options="options" :confirm="false" @on-change="changeDate6"
                  type="date" multiple :editable="false" @on-clear="onClear" size="small" placeholder="请选择闭馆日期"
                  v-model="closeDate1time" class="remote1">
                </DatePicker>
              </div>

              <!-- <div style="display: flex; flex-direction: row;align-items: center;">
                <div style="width: 10vw;text-align: center;line-height: 42px;">开放天数(一周内):</div> <Input v-model="value1"
                  size="large"  placeholder="请输入" />
              </div> -->
              <FormItem label="预约开放天数（一周内）：" label-width="220px"
                style="display: flex;align-items: center;width: 500px;">
                <InputNumber :min="0" :max="7" v-model="value1"></InputNumber>

              </FormItem>
              <div style="display: flex; flex-direction: row;align-items: center;">
                <div style="width: 10vw;text-align: center;line-height: 42px;">提前预约天数:</div> <Input v-model="yuyue"
                  size="large" placeholder="请输入" />
              </div>
              <div style="display: flex;  flex-direction: row;align-items: center;">
                <div style="width: 8vw;text-align: center;line-height: 42px;">团队预约功能:</div>
                <i-switch v-model="idCardSwitchs" size="large">
                  <span slot="open">开启</span>
                  <span slot="close">关闭</span>
                </i-switch>
              </div>
              <div>
                <div style="width: 8vw;text-align: center;line-height: 42px;">预约限制功能:</div>
                <div style="display: flex;">
                  <div style="width: 8vw;text-align: center;line-height: 42px;">人数上限:</div><Input v-model="valuenumber1"
                    size="large" placeholder="请输入" />
                </div>
                <div style="display: flex;">
                  <div style="width: 8vw;text-align: center;line-height: 42px;">人数下限:</div> <Input
                    v-model="valuenumber2" size="large" placeholder="请输入" />
                </div>
              </div>
              
            </Modal>
          </FormItem>
          <FormItem label="闭馆日期：">
            <DatePicker transfer :clearable="false" :options="options" :confirm="false" @on-change="changeDate"
              type="date" multiple :editable="false" @on-clear="onClear" size="small" placeholder="请选择闭馆日期"
              v-model="closeDate1" class="remote"></DatePicker>
            <Button class="quickly" type="success" size="large" @click="showmodel">快捷设置
            </Button>
            <Modal v-model="modelshow2" title="批量设置闭馆日期" @on-ok="ok2" @on-cancel="cancels">
              <Form>
                <div class="findtime">
                  <FormItem label="起止日期">
                    <DatePicker :clearable="clearable" format="yyyy-MM-dd" type="daterange" placeholder="请选择起止时间"
                      style="width: 200px" :value="time2" @on-change="onChange"></DatePicker>
                  </FormItem>
                  <FormItem label="设置星期">
                    <div>
                      <el-checkbox-group v-model="checkboxGroup4" size="mini">
                        <el-checkbox-button v-for="week in weeks" :label="week" :key="week">{{ week }}
                        </el-checkbox-button>
                      </el-checkbox-group>
                    </div>
                  </FormItem>
                </div>
              </Form>
            </Modal>
            <!-- <Modal v-model="modelshow2" title="批量设置闭馆日期" @on-ok="ok2" @on-cancel="cancels">
              <Form>
                <div class="findtime">
                  <FormItem label="起止日期">
                    <DatePicker :clearable="clearable" format="yyyy-MM-dd" type="daterange" placeholder="请选择起止时间"
                      style="width: 200px" :value="time2" ></DatePicker>
                  </FormItem>
                  <FormItem label="设置星期">
                    <div>
                      <el-checkbox-group v-model="checkboxGroup4" size="mini">
                        <el-checkbox-button v-for="week in weeks" :label="week" :key="week">{{ week }}
                        </el-checkbox-button>
                      </el-checkbox-group>
                    </div>
                  </FormItem>
                </div>
              </Form>
            </Modal> -->

            <Tooltip max-width="400" content="按每周常规闭馆日自动设置场馆闭馆日期，也可手动选择指定日期是否闭馆" placement="bottom">
              <Icon style="margin-left: 10px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
            </Tooltip>
          </FormItem>
          <!-- <FormItem label="临时闭馆提示内容：">
            <div style="display: flex">
              <Input style="width: 900px" v-model="data.temporaryClosureTips"></Input>
              <Tooltip max-width="400" content="此处填写临时闭馆的原因" placement="bottom">
                <Icon style="margin-left: 15px; margin-top: 7px" size="20" type="ios-help-circle-outline" />
              </Tooltip>
            </div>
          </FormItem> -->

          <Button type="success" size="large" style="width: 100%; margintop: 20px" @click="submit"
            :loading="spinShow2">提交
          </Button>
        </Form>
      </el-tab-pane>
      <!-- <el-tab-pane label="健康申明问卷版">
        <Questionnaire
          :healthQuestionnaireSwitch="gonggaoData['healthQuestionnaireSwitch']"
        />
      </el-tab-pane> -->
      <el-tab-pane label="参观须知(个人)">
        <p class="title">参观须知</p>
        <vue-tinymce :value="data.visitingInformation" @catchData="catchData2"></vue-tinymce>
        <div style="
            display: flex;
            align-items: center;
            margin-top: 20px;
            margin-bottom: 10px;
          "></div>
        <Button type="success" size="large" style="width: 100%; margin-top: 10px" @click="submit1"
          :loading="spinShow2">提交
        </Button>
      </el-tab-pane>
      <el-tab-pane label="参观须知(团队)">
        <p class="title">参观须知</p>
        <vue-tinymce :value="data.visitingInformations" @catchData="catchData2s"></vue-tinymce>
        <div style="
            display: flex;
            align-items: center;
            margin-top: 20px;
            margin-bottom: 10px;
          "></div>
        <Button type="success" size="large" style="width: 100%; margin-top: 10px" @click="submit1s"
          :loading="spinShow2s">提交
        </Button>
      </el-tab-pane>
      <!-- <el-tab-pane label="导出观众海报">
        <el-image class="imgs"  src="http://test.static.bowu66.com/ztmuseum/uploads/53f525ffb79541489e65be4d2e015f74.jpg" ></el-image>
        <Button type="success" long @click="exbtn">导出观众海报</Button>
      </el-tab-pane> -->
    </el-tabs>

    <Modal title="温馨提示" :mask-closable="false" :closable="false" v-model="sureModal">
      <p style="font-size: 20px; font-weight: bold; text-align: center">
        身份校验是游客预约时是否需提供身份信息。
      </p>
      <p style="font-size: 18px; font-weight: bold; text-align: center">
        如您要关闭，则游客预约时则只需填写姓名和手机号。
      </p>
      <div slot="footer">
        <Button type="warning" class="Button" @click="cancel">取消</Button>
        <Button type="success" class="Button" :loading="loading" @click="sureOk">确认关闭
        </Button>
      </div>
    </Modal>

    <Modal title="温馨提示" :mask-closable="false" :closable="false" v-model="sureModal2">
      <p style="font-size: 20px; font-weight: bold; text-align: center">
        健康码校验是游客预约时是否通过健康码接口验证。
      </p>
      <p style="font-size: 18px; font-weight: bold; text-align: center">
        如您要关闭，则游客预约时将不校验健康数据。
      </p>
      <div slot="footer">
        <Button type="warning" class="Button" @click="cancel2">取消</Button>
        <Button type="success" class="Button" :loading="loading2" @click="sureOk2">确认关闭
        </Button>
      </div>
    </Modal>

    <Modal title="温馨提示" :mask-closable="false" :closable="false" v-model="sureModal3">
      <p style="font-size: 20px; font-weight: bold; text-align: center">
        多次入园是指游客是否可以在有效时间段内多次进出。
      </p>
      <p style="font-size: 18px; font-weight: bold; text-align: center">
        如您要关闭，则游客在第一次核验后，将无法再次核验。
      </p>
      <div slot="footer">
        <Button type="warning" class="Button" @click="cancel3">取消</Button>
        <Button type="success" class="Button" :loading="loading3" @click="sureOk3">确认关闭
        </Button>
      </div>
    </Modal>
  </div>
</template>

<script>
  import Questionnaire from "./Questionnaire";
  import BasicInfo from "./BasicInfo.vue";
  import axios from 'axios'
  export default {
    components: {
      Questionnaire,
      BasicInfo
    },
    data() {
      return {
        tips: '',
        Tid: "",
        checkboxGroup4: [],
        weeks: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
        clearable: false,
        value1: "",
        yuyue: '',
        modalzq: false,
        time: [],
        modelshow2: false,
        time2: [],
        spinShow2: false,
        loading: false,
        loading2: false,
        loading3: false,
        form: {
          phonenum: "",
          region: [],
          trueorfalse: [],
        },
        sureModal: false,
        valuenumber1: "",
        valuenumber2: "",
        sureModal2: false,
        sureModal3: false,
        closeDate1: [],
        closeDate1time: [],
        closeDate2: [],
        gonggaoData: {},
        idCardSwitchs: false,
        data: {
          visitingInformation: "",
          visitingInformations: "",
          advanceMinute: 1,
          delayedMinute: 1,
          duplicateSessionSwitch: false,
          healthCodeSwitch: false,
          idCardSwitch: false,
          multipleAdmissionsSwitch: false,
          closeDate: [],
          singleLimit: 1,
          singleChildLimit: 0,
          personalAppointmentSwitch: false,
          teamAppointmentSwitch: false,
          temporaryClosureSwitch: false,
          temporaryClosureTips: "",
          advanceDay: "",
          openDay: ""
        },
        options: {
          disabledDate(date) {
            return date && date.valueOf() < Date.now() - 86400000;
          },
        },
      };
    },
    created() {
      this.getReservationConfigBase();
      this.getReservationTeamConfig()
    },
    methods: {
      ok2() {
        if (this.time2.length == 0) {
          this.$Message.error("请选择日期");
          this.checkboxGroup4 = [];

          this.time2 = [];
          return;
        }
        console.log("ok");
        console.log(this.checkboxGroup4);
        // console.log(this.museumId)
        console.log(this.time2);

        console.log(this.time);
        var time = JSON.parse(JSON.stringify(this.time));

        var checkboxGroup4 = JSON.parse(JSON.stringify(this.checkboxGroup4));
        var checkbox = [];
        for (let k = 0; k < checkboxGroup4.length; k++) {
          checkbox.push(checkboxGroup4[k].replace("周", ""));
        }
        console.log(checkbox);
        for (let l = 0; l < checkbox.length; l++) {
          if (checkbox[l] == "一") {
            checkbox[l] = 1;
          } else if (checkbox[l] == "二") {
            checkbox[l] = 2;
          } else if (checkbox[l] == "三") {
            checkbox[l] = 3;
          } else if (checkbox[l] == "四") {
            checkbox[l] = 4;
          } else if (checkbox[l] == "五") {
            checkbox[l] = 5;
          } else if (checkbox[l] == "六") {
            checkbox[l] = 6;
          } else if (checkbox[l] == "日") {
            checkbox[l] = 7;
          }
        }
        console.log(time, checkbox);

        this.$http(
          "/chongqing/stage/reservation-config/batchSaveClosedSetting", {
            end: this.time2[1],
            begin: this.time2[0],
            weeks: checkbox,
          },
          "post",
          (res) => {
            this.modelshow = false;
            console.log(res);
            console.log(res.data.code);
            if (res.data.code == 1000 && res.data.data) {
              this.$Message.success("修改成功");
              this.getReservationConfigBase();
              // this.getClosedSettingByMonth()
            } else {
              this.$Message.error(res.data.msg);
            }

            this.checkboxGroup4 = [];

            this.time2 = [];
          }
        );
      },
      getReservationConfigBase() {
        this.$http(
          "/chongqing/stage/reservation-config/getReservationConfigBase", {},
          "get",
          (res) => {
            console.log(res, "88888888888888888888888888888");
            if (res.data.code == 1000) {
              this.data = res.data.data;
              let arr = [];
              for (let i = 0; i < res.data.data.closeDate.length; i++) {
                if (res.data.data.closeDate[i] != "") {
                  arr.push(res.data.data.closeDate[i]);
                }
              }
              console.log(arr, 111);
              this.data.closeDate = arr;
              this.closeDate1 = arr.join(",");
              // this.closeDate1time = arr.join(",")
              this.closeDate2 = arr;
              console.log(closeDate2);
            } else {
              this.$Message.error(res.data.msg);
            }
          }
        );
      },
      changeDate6(data) {
        this.closeDate1time = data;
        console.log(this.closeDate1time);
        // if (data != "") {
        //   this.data.closeDate = data.split(",");
        // } else {
        //   this.data.closeDate = [];
        // }
      },
      changeDate(data) {
        console.log(data);
        this.closeDate1 = data;

        if (data != "") {
          this.data.closeDate = data.split(",");
        } else {
          this.data.closeDate = [];
        }
      },
      onClear() {
        this.$Modal.confirm({
          title: "提示",
          content: "<p>确定要清空所有闭馆日期吗？</p>",
          onOk: () => {
            this.closeDate1 = [];
            // this.closeDate1time = [];
            this.data.closeDate = [];
            // this.emptyClosedSetting()
          },
          onCancel: () => {
            // this.getClosedSettingByMonth()
            this.getReservationConfigBase();
          },
        });
      },
      //获取团队预约配置
      getReservationTeamConfig() {
        this.$http(
          "/chongqing/stage/reservation-config/getReservationTeamConfig", {},
          "get",
          (res) => {
            console.log(res, "我是400行");
            this.value1 = res.data.data.openDay,
              this.yuyue = res.data.data.advanceDay
            this.closeDate1time = res.data.data.closeDate,
              this.idCardSwitchs = res.data.data.teamAppointmentSwitch,
              this.valuenumber1 = res.data.data.teamLimitMax,
              this.valuenumber2 = res.data.data.teamLimitMin
            this.Tid = res.data.data.id
          })
      },
      //修改团队预约配置
      ok() {
        this.$http(
          "/chongqing/stage/reservation-config/updateReservationTeamConfigBase", {
            "advanceDay": Number(this.yuyue),
            "openDay": Number(this.value1),
            "closeDate": this.closeDate1time,
            "id": this.Tid != "" ? this.Tid : '',
            "teamAppointmentSwitch": this.idCardSwitchs,
            "teamLimitMax": Number(this.valuenumber1),
            "teamLimitMin": Number(this.valuenumber2)
          },
          "post",
          (res) => {
            this.$Message.success("修改团队预约配置成功");
            console.log(res, "修改团队预约配置成功", "我是417行");
            this.getReservationTeamConfig()
          }
        )
      },

      //导出海报
      exbtn() {
        const href = "http://test.static.bowu66.com/ztmuseum/uploads/53f525ffb79541489e65be4d2e015f74.jpg";
        axios.get(href, {
          responseType: "blob"
        }).then((res) => {
          console.log(res);
          const blob = new Blob([res.data])
          const downloadElement = document.createElement('a')
          const href = window.URL.createObjectURL(blob)
          downloadElement.style.display = 'none'
          downloadElement.href = href
          downloadElement.download = '海报.png' // 下载后文件名
          document.body.appendChild(downloadElement)
          downloadElement.click() // 点击下载
          document.body.removeChild(downloadElement) // 下载完成移除元素
          window.URL.revokeObjectURL(href) // 释放掉blob对象
        })
      },


      // 取消关闭
      cancel() {
        this.sureModal = false;
      },
      // 确认关闭
      sureOk() {
        this.sureModal = false;
      },
      // 取消关闭
      cancel2() {
        this.sureModal2 = false;
      },
      // 确认关闭
      sureOk2() {
        this.sureModal2 = false;
      },

      // 取消关闭
      cancel3() {
        this.sureModal3 = false;
      },
      // 确认关闭
      sureOk3() {
        this.sureModal3 = false;
      },
      getReservationNotice() {
        this.$http(
          "/chongqing/stage/reservation-config/getReservationNotice", {},
          "get",
          (res) => {
            console.log(res);
            if (res.data.code == 1000) {
              this.data.visitingInformation = res.data.data.bulletin;
              console.log(this.data.visitingInformation);
              this.data.id = res.data.data.id;
              this.showHtml();
            } else {
              this.$Message.error(res.data.msg);
            }
          }
        );
      },
      getTeamReservationNotice() {
        this.$http(
          "/chongqing/stage/reservation-config/getTeamReservationNotice", {},
          "get",
          (res) => {
            console.log(res);
            if (res.data.code == 1000) {
              this.data.visitingInformations = res.data.data.bulletin;
              this.data.id = res.data.data.id;
              this.showHtmls()
            }
          }
        )
      },
      tabClick(name) {
        console.log(name.index);
        if (name.index == "2") {
          // this.data.visitingInformation=''
          this.getReservationNotice();
        }else if(name.index == "3"){
          this.getTeamReservationNotice()
        }
      },
     
      showHtml() {
        this.spinShow2 = true;
        this.$http(
          "/chongqing/stage/reservation-config/updateReservationNotice", {
            bulletin: this.data.visitingInformation,
            id: this.data.id,
          },
          "post",
          (res) => {
            console.log(res);
            if (res.data.code == 1000 && res.data.data) {
              // this.$Message.success('nihao1')
            } else {
              this.$Message.error(res.data.msg);
            }
            this.spinShow2 = false;
          }
        );
      },
      showHtmls() {
        this.spinShow2 = true;
        this.$http(
          "/chongqing/stage/reservation-config/updateTeamBulletin", {
            bulletin: this.data.visitingInformations,
            id: this.data.id,
          },
          "post",
          (res) => {
            console.log(res);
            if (res.data.code == 1000 && res.data.data) {
              // this.$Message.success('nihao1')
            } else {
              this.$Message.error(res.data.msg);
            }
            this.spinShow2 = false;
          }
        );
      },
      submit1() {
        this.spinShow2 = true;
        this.$http(
          "/chongqing/stage/reservation-config/updateReservationNotice", {
            bulletin: this.data.visitingInformation,
            id: this.data.id,
          },
          "post",
          (res) => {
            console.log(res);
            if (res.data.code == 1000 && res.data.data) {
              this.$Message.success("修改预约公告成功");
              this.getReservationNotice();
            } else {
              this.$Message.error(res.data.msg);
            }
            this.spinShow2 = false;
          }
        );
      },
      submit1s(){
        this.$http(
          "/chongqing/stage/reservation-config/updateTeamBulletin",{
            bulletin: this.data.visitingInformations,
            id: this.data.id,
          },
          "post",
          (res)=>{
            if(res.data.code == 1000 && res.data.data){
              this.$Message.success("修改预约公告成功");
              this.getTeamReservationNotice()
            }else{
              this.$Message.error(res.data.msg);
            }
          }
        )
      },
      submit() {
        console.log(this.data);
        console.log(this.closeDate1);
        let data = {
          advanceMinute: this.data.advanceMinute,
          delayedMinute: this.data.delayedMinute,
          advanceDay: this.data.advanceDay,
          openDay: this.data.openDay,
          closeDate: this.data.closeDate,
          duplicateSessionSwitch: this.data.duplicateSessionSwitch,
          healthCodeSwitch: this.data.healthCodeSwitch,
          id: this.data.id,
          idCardSwitch: this.data.idCardSwitch,
          multipleAdmissionsSwitch: this.data.multipleAdmissionsSwitch,
          personalAppointmentSwitch: this.data.personalAppointmentSwitch,
          singleLimit: this.data.singleLimit,
          singleChildLimit: this.data.singleChildLimit,
          teamAppointmentSwitch: this.data.teamAppointmentSwitch,
          temporaryClosureSwitch: this.data.temporaryClosureSwitch,
          temporaryClosureTips: this.data.temporaryClosureTips,
        };
        this.spinShow2 = true;
        this.$http(
          "/chongqing/stage/reservation-config/updateReservationConfigBase",
          data,
          "post",
          (res) => {
            console.log(res);
            if (res.data.code == 1000 && res.data.data) {
              this.$Message.success("修改成功");
              this.getReservationConfigBase();
            } else {
              this.$Message.error(res.data.msg);
            }
            this.spinShow2 = false;
          }
        );
      },
      catchData2(data) {
        this.data.visitingInformation = data;
      },
      catchData2s(data) {
        this.data.visitingInformations = data;
      },
      showmodel() {
        this.modelshow2 = true;
      },
      onChange(data) {
        console.log(data);
        this.time2 = data;
        console.log(this.checkboxGroup4);
      },
      ok2() {
        if (this.time2.length == 0) {
          this.$Message.error("请选择日期");
          this.checkboxGroup4 = [];

          this.time2 = [];
          return;
        }
        console.log("ok");
        console.log(this.checkboxGroup4);
        // console.log(this.museumId)
        console.log(this.time2);

        console.log(this.time);
        var time = JSON.parse(JSON.stringify(this.time));

        var checkboxGroup4 = JSON.parse(JSON.stringify(this.checkboxGroup4));
        var checkbox = [];
        for (let k = 0; k < checkboxGroup4.length; k++) {
          checkbox.push(checkboxGroup4[k].replace("周", ""));
        }
        console.log(checkbox);
        for (let l = 0; l < checkbox.length; l++) {
          if (checkbox[l] == "一") {
            checkbox[l] = 1;
          } else if (checkbox[l] == "二") {
            checkbox[l] = 2;
          } else if (checkbox[l] == "三") {
            checkbox[l] = 3;
          } else if (checkbox[l] == "四") {
            checkbox[l] = 4;
          } else if (checkbox[l] == "五") {
            checkbox[l] = 5;
          } else if (checkbox[l] == "六") {
            checkbox[l] = 6;
          } else if (checkbox[l] == "日") {
            checkbox[l] = 7;
          }
        }
        console.log(time, checkbox);

        this.$http(
          "/chongqing/stage/reservation-config/batchSaveClosedSetting", {
            end: this.time2[1],
            begin: this.time2[0],
            weeks: checkbox,
          },
          "post",
          (res) => {
            this.modelshow = false;
            console.log(res);
            console.log(res.data.code);
            if (res.data.code == 1000 && res.data.data) {
              this.$Message.success("修改成功");
              this.getReservationConfigBase();
              // this.getClosedSettingByMonth()
            } else {
              this.$Message.error(res.data.msg);
            }

            this.checkboxGroup4 = [];

            this.time2 = [];
          }
        );
      },
      cancels() {
        this.modelshow = false;
        this.checkboxGroup4 = [];

        this.time2 = [];
      },
    },
  };

</script>

<style scoped>
  .imgs {
    width: 100%;
    height: 400px;
  }

  .title {
    text-align: center;
    line-height: 50px;
    font-weight: bold;
    font-size: 24px;
  }

  .pro {
    display: inline-block;
    padding: 0 4px;
    border: 1px solid #eee;
    margin-right: 5px;
    margin-bottom: 2px;
  }

  .leftbutton {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .el-select {
    width: 400px;
  }

  .el-input-number /deep/ .el-input input {
    height: 40px;
    margin-top: -2px;
  }

  .fixed {
    display: flex;
    flex-wrap: wrap;

    width: 100%;
  }

  .formitem {
    width: 33%;
  }

  .remote {
    width: 900px;
  }

  .remote1 {
    width: 100%;
  }

  .remote /deep/ input {
    padding-right: 30px;
  }

  .remote /deep/ span {
    line-height: 35px;
  }

  .label /deep/ ivu-form-item-label {
    width: 220px;
    margin-left: 80px;
  }

  div.ivu-form-item-label /deep/ {
    margin-left: 0px;
  }

</style>
